{template '_header'}
<style>
    .select2{
        margin:0;
        width:100%;
        height:34px;
        border-radius: 3px;
        border-color: rgb(229, 230, 231);
    }
    .select2 .select2-choice{
        height: 34px;
        line-height: 32px;
        border-radius: 3px;
        border-color: rgb(229, 230, 231);
    }
    .select2 .select2-choice .select2-arrow{
        background: #fff;
    }
</style>
<div class="page-heading">
    <div class="pull-right" style="text-align: right;margin-top: 10px;" >
        <strong>高级模式</strong>
        <input class="js-switch small" type="checkbox" {if !empty($data['tm']['is_advanced'])}checked{/if}/>
    </div>
    <h2>通知设置</h2>

</div>
<form id="setform"  action="" method="post" class="form-horizontal form-validate">
    <input type="hidden" value="{php echo intval($data['tm']['is_advanced'])}" name='data[is_advanced]' />
    <div id="normal">
        <div class='alert alert-info'>
            默认为全部开启，用户在会员中心可自行设置是否开启, 模板消息自动替换变量
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">任务处理通知</label>
            <div class="col-sm-9 col-xs-12">
                <input type="text" name="data[templateid]" class="form-control" value="{$data['tm']['templateid']}" />
                <div class="help-block">公众平台模板消息编号: OPENTM200605630 </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">成为分销商通知</label>
            <div class="col-sm-9 col-xs-12">
                <input type="text" name="data[commission_becometitle]" class="form-control" value="{$data['tm']['commission_becometitle']}" />
                <div class="help-block">标题，默认"成为分销商通知"</div>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-2 control-label"></label>
            <div class="col-sm-9 col-xs-12">
                <textarea  name="data[commission_become]" class="form-control" >{$data['tm']['commission_become']}</textarea>
                模板变量: [昵称] [时间]
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-2 control-label">新增下级通知</label>
            <div class="col-sm-9 col-xs-12">
                <input type="text" name="data[commission_agent_newtitle]" class="form-control" value="{$data['tm']['commission_agent_newtitle']}" />
                <div class="help-block">标题，默认"新增下线通知"</div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label"></label>
            <div class="col-sm-9 col-xs-12">
                <textarea  name="data[commission_agent_new]" class="form-control" >{$data['tm']['commission_agent_new']}</textarea>
                <div class='help-block'>模板变量: [昵称] [时间]</div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">下级付款通知</label>
            <div class="col-sm-9 col-xs-12">
                <input type="text" name="data[commission_order_paytitle]" class="form-control" value="{$data['tm']['commission_order_paytitle']}" />
                <div class="help-block">标题，默认"下级付款通知"</div>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-2 control-label"></label>
            <div class="col-sm-9 col-xs-12">
                <textarea  name="data[commission_order_pay]" class="form-control" >{$data['tm']['commission_order_pay']}</textarea>
                <div class="help-block">模板变量 [昵称] [订单编号] [订单金额] [商品详情] [佣金金额] [时间]</div>
                <div class="help-block">注意: 此 [佣金金额] ，不代表上级用户会立即获得，为可能获得的佣金金额</div>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-2 control-label">下级确认收货通知</label>
            <div class="col-sm-9 col-xs-12">
                <input type="text" name="data[commission_order_finishtitle]" class="form-control" value="{$data['tm']['commission_order_finishtitle']}" />
                <div class="help-block">标题，默认"下级确认收货通知"</div>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-2 control-label"></label>
            <div class="col-sm-9 col-xs-12">
                <textarea  name="data[commission_order_finish]" class="form-control" >{$data['tm']['commission_order_finish']}</textarea>
                <div class="help-block">模板变量 [昵称] [订单编号] [订单金额] [商品详情] [佣金金额] [时间]</div>
                <div class="help-block">注意: 此 [佣金金额] ，不代表上级用户会立即获得，为可能获得的佣金金额</div>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-2 control-label">提现申请提交通知</label>
            <div class="col-sm-9 col-xs-12">
                <input type="text" name="data[commission_applytitle]" class="form-control" value="{$data['tm']['commission_applytitle']}" />
                <div class="help-block">标题，默认"提现申请提交通知"</div>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-2 control-label"></label>
            <div class="col-sm-9 col-xs-12">
                <textarea  name="data[commission_apply]" class="form-control" >{$data['tm']['commission_apply']}</textarea>
                模板变量 [昵称] [时间] [金额] [提现方式]
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">提现申请审核完成通知</label>
            <div class="col-sm-9 col-xs-12">
                <input type="text" name="data[commission_checktitle]" class="form-control" value="{$data['tm']['commission_checktitle']}" />
                <div class="help-block">标题，默认"提现申请审核完成通知"</div>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-2 control-label"></label>
            <div class="col-sm-9 col-xs-12">
                <textarea  name="data[commission_check]" class="form-control" >{$data['tm']['commission_check']}</textarea>
                模板变量 [昵称] [提现方式]  [金额] [时间]
            </div>
        </div>


        <div class="form-group">
            <label class="col-sm-2 control-label">佣金打款通知</label>
            <div class="col-sm-9 col-xs-12">
                <input type="text" name="data[commission_paytitle]" class="form-control" value="{$data['tm']['commission_paytitle']}" />
                <div class="help-block">标题，默认"佣金打款通知"</div>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-2 control-label"></label>
            <div class="col-sm-9 col-xs-12">
                <textarea  name="data[commission_pay]" class="form-control" >{$data['tm']['commission_pay']}</textarea>
                模板变量 [昵称] [提现方式] [金额] [时间]
            </div>
        </div>


        <div class="form-group">
            <label class="col-sm-2 control-label">分销商等级升级通知</label>
            <div class="col-sm-9 col-xs-12">
                <input type="text" name="data[commission_upgradetitle]" class="form-control" value="{$data['tm']['commission_upgradetitle']}" />
                <div class="help-block">标题，默认"分销商等级升级通知"</div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label"></label>
            <div class="col-sm-9 col-xs-12">
                <textarea  name="data[commission_upgrade]" class="form-control" >{$data['tm']['commission_upgrade']}</textarea>
                模板变量: [昵称] [旧等级]  [旧一级分销比例] [旧二级分销比例] [旧三级分销比例] [新等级] [新一级分销比例] [新二级分销比例] [新三级分销比例]  [时间]
            </div>
        </div>
    </div>
    <div id="advanced">
        <div class='alert alert-success'>
            使用高级模式 , 将全部启用自定义的模板内容进行推送 !
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">成为分销商通知</label>
            <div class="col-sm-9 col-xs-12">
                <select class="select2" name="data[commission_become_advanced]">
                    <option>从模板消息库中选择</option>
                    {loop $template_list $template_val}
                    <option value="{$template_val['id']}" {if $data['tm']['commission_become_advanced'] == $template_val['id'] }selected{/if}>{$template_val['title']}</option>
                    {/loop}
                </select>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-2 control-label">新增下级通知</label>
            <div class="col-sm-9 col-xs-12">
                <select class="select2" name="data[commission_agent_new_advanced]">
                    <option>从模板消息库中选择</option>
                    {loop $template_list $template_val}
                    <option value="{$template_val['id']}" {if $data['tm']['commission_agent_new_advanced'] == $template_val['id'] }selected{/if}>{$template_val['title']}</option>
                    {/loop}
                </select>
            </div>
        </div>

        <div class="form-group-title">下级通知</div>
        <div class="form-group">
            <label class="col-sm-2 control-label">下级付款通知</label>
            <div class="col-sm-9 col-xs-12">

                <select class="select2" name="data[commission_order_pay_advanced]">
                    <option>从模板消息库中选择</option>
                    {loop $template_list $template_val}
                    <option value="{$template_val['id']}" {if $data['tm']['commission_order_pay_advanced'] == $template_val['id'] }selected{/if}>{$template_val['title']}</option>
                    {/loop}
                </select>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-2 control-label">下级确认收货通知</label>
            <div class="col-sm-9 col-xs-12">
                <select class="select2" name="data[commission_order_finish_advanced]">
                    <option>从模板消息库中选择</option>
                    {loop $template_list $template_val}
                    <option value="{$template_val['id']}" {if $data['tm']['commission_order_finish_advanced'] == $template_val['id'] }selected{/if}>{$template_val['title']}</option>
                    {/loop}
                </select>
            </div>
        </div>
        <div class="form-group-title">提现通知</div>
        <div class="form-group">
            <label class="col-sm-2 control-label">提现申请提交通知</label>
            <div class="col-sm-9 col-xs-12">
                <select class="select2" name="data[commission_apply_advanced]">
                    <option>从模板消息库中选择</option>
                    {loop $template_list $template_val}
                    <option value="{$template_val['id']}" {if $data['tm']['commission_apply_advanced'] == $template_val['id'] }selected{/if}>{$template_val['title']}</option>
                    {/loop}
                </select>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-2 control-label">提现申请审核完成通知</label>
            <div class="col-sm-9 col-xs-12">
                <select class="select2" name="data[commission_check_advanced]">
                    <option>从模板消息库中选择</option>
                    {loop $template_list $template_val}
                    <option value="{$template_val['id']}" {if $data['tm']['commission_check_advanced'] == $template_val['id'] }selected{/if}>{$template_val['title']}</option>
                    {/loop}
                </select>
            </div>
        </div>

        <div class="form-group-title">佣金通知</div>
        <div class="form-group">
            <label class="col-sm-2 control-label">佣金打款通知</label>
            <div class="col-sm-9 col-xs-12">
                <select class="select2" name="data[commission_pay_advanced]">
                    <option>从模板消息库中选择</option>
                    {loop $template_list $template_val}
                    <option value="{$template_val['id']}" {if $data['tm']['commission_pay_advanced'] == $template_val['id'] }selected{/if}>{$template_val['title']}</option>
                    {/loop}
                </select>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-2 control-label">分销商等级升级通知</label>
            <div class="col-sm-9 col-xs-12">
                <select class="select2" name="data[commission_upgrade_advanced]">
                    <option>从模板消息库中选择</option>
                    {loop $template_list $template_val}
                    <option value="{$template_val['id']}" {if $data['tm']['commission_upgrade_advanced'] == $template_val['id'] }selected{/if}>{$template_val['title']}</option>
                    {/loop}
                </select>
            </div>
        </div>

    </div>
        <div class="form-group">
            <label class="col-sm-2 control-label"></label>
            <div class="col-sm-9">
                <input type="submit" value="提交" class="btn btn-primary" />
            </div>
        </div>
</form>
<script>
    $(function () {
        $(".js-switch").click(function () {
            $(":input[name='data[is_advanced]']").val( this.checked ?1:0);
            if (this.checked)
            {
                $("#advanced").show();
                $("#normal").hide();
            }
            else
            {
                $("#advanced").hide();
                $("#normal").show();
            }
        })

        if($(":input[name='data[is_advanced]']").val() == 1)
        {
            $("#advanced").show();
            $("#normal").hide();
        }
        else
        {
            $("#advanced").hide();
            $("#normal").show();
        }
    })
</script>
{template '_footer'}